<template>
	<view class="pages" :class="isMove?'banMove':''">

		<!-- 支付方式 -->
		<view class="payType">
			<view>
				<view class="type" :class="index == 1?'type2':index == 2?'type3':''" v-for="(item,index) in walletType"
					:key="index" @tap="changeWalletType(item)">
					<image src="@/static/mine/level1.png" class="level-img"></image>
					<view class="payState">
						<view class="payTitle">{{item.name}}</view>
						<view class="payTitles">强强联手~联手赚个小目标</view>
					</view>
					<image
						:src="walletId == item.level?'../../static/mine/selectLevel1.png':'../../static/mine/noSelectLevel1.png'"
						class="radioImg"></image>
					<!-- <image v-if="index == 1" :src="walletId == item.level?'../../static/mine/selectLevel2.png':'../../static/mine/noSelectLevel2.png'" class="radioImg"></image>
					<image v-if="index == 2" :src="walletId == item.level?'../../static/mine/selectLevel3.png':'../../static/mine/noSelectLevel3.png'" class="radioImg"></image> -->
				</view>
			</view>


		</view>

		<view class="loginContent" @tap="submit">确认</view>

	</view>
</template>

<script>
	import {
		getLockMechanism,
		balanceToHappyBean
	} from '@/api/api.js'
	export default {
		data() {
			return {
				// 控制屏幕滑动
				isMove: false,
				walletId: 1,
				walletType: [],
				amount: 0,
				isProp: false,
			}
		},
		onLoad(e) {

		},
		onShow() {
			this.getLevelInfo()
		},
		methods: {
			getLevelInfo() {
				let data = {}
				getLockMechanism(data).then(res => {
					if (res.code == 200) {
						this.walletType = res.data
						this.walletId = this.walletType[0].level
						this.amount = this.walletType[0].lockAmount
					}
				})
			},
			changeWalletType(item) {
				this.walletId = item.level
				this.amount = item.lockAmount
			},
			submit() {
				let data = {
					amount: this.amount,
				}
				uni.showModal({
					title: '确认锁仓',
					content: '是否确认锁仓?',
					confirmColor: '#007AFF',
					showCancel: true,
					confirmText: '确认',
					success(res) {
						if (res.confirm) {
							balanceToHappyBean(data).then(res => {
								if (res.code == 200) {
									uni.showToast({
										title: '申请成功',
										icon: 'none'
									})
									setTimeout(function() {
										uni.switchTab({
											url: '/pages/mine/index'
										})
									}, 500)
								}

							})
						} else if (res.cancel) {

						}

					}
				})

			},

		}
	}
</script>

<style>
	page {
		background-color: rgba(246, 246, 247, 1);
	}
</style>
<style lang="less">
	.banMove {
		position: fixed;
		bottom: 0;
		height: 100%;
	}

	.pages {
		letter-spacing: 1rpx;
		display: flex;
		flex-direction: column;
		align-items: center;

		.payType {

			.type {
				margin-top: 20rpx;
				padding: 40rpx 50rpx 40rpx 40rpx;
				width: 620rpx;
				background: #EEFFF9;
				border-radius: 20rpx;
				display: flex;
				align-items: center;
				position: relative;

				.level-img {
					width: 80rpx;
					height: 80rpx;
					margin-right: 40rpx;
				}

				.payState {
					.payImg {
						width: 56rpx;
						height: 56rpx;
					}

					.payTitle {
						font-family: PingFang SC, PingFang SC;
						font-weight: bold;
						font-size: 36rpx;
						color: #005337;
						line-height: 36rpx;
					}

					.payTitles {
						margin-top: 20rpx;
						font-family: Alibaba PuHuiTi, Alibaba PuHuiTi;
						font-weight: 400;
						font-size: 24rpx;
						color: #55B193;
						line-height: 24rpx;
					}
				}

				.radioImg {
					position: absolute;
					top: 60rpx;
					right: 50rpx;
					width: 40rpx;
					height: 40rpx;
				}
			}

			.type2 {
				background-color: rgba(244, 251, 255, 1);

				.payState {
					.payTitle {
						color: rgba(0, 65, 102, 1);
					}

					.payTitles {
						color: rgba(77, 124, 151, 1);
					}
				}
			}

			.type3 {
				background-color: rgba(255, 250, 238, 1);

				.payState {
					.payTitle {
						color: rgba(160, 113, 0, 1);
					}

					.payTitles {
						color: rgba(141, 121, 71, 1);
					}
				}
			}
		}

		.loginContent {
			width: 670rpx;
			height: 88rpx;
			text-align: center;
			line-height: 88rpx;
			background: #EB3B27;
			border-radius: 88rpx;
			font-family: PingFang SC, PingFang SC;
			font-weight: bold;
			font-size: 36rpx;
			color: #FFFFFF;
			margin-top: 20rpx;
		}

		.prop {
			display: flex;
			align-items: center;
			justify-content: center;
			position: absolute;
			top: 0;
			left: 0;
			width: 100vw;
			height: 100vh;
			background: rgba(26, 26, 26, 0.45);

			.buyProp {
				padding-bottom: 40rpx;
				position: relative;
				display: flex;
				align-items: center;
				flex-direction: column;
				width: 560rpx;
				background: #FFFFFF;
				border-radius: 20rpx;

				.closeImg {
					width: 24rpx;
					height: 24rpx;
					position: absolute;
					top: 37rpx;
					right: 25rpx;
				}

				.title {
					margin-top: 38rpx;
					font-size: 30rpx;
					font-family: PingFangSC-Medium, PingFang SC;
					font-weight: 500;
					color: #1A1A1A;
					line-height: 42rpx;
				}

				.numTitle {
					margin-top: 46rpx;
					width: 470rpx;
					font-size: 26rpx;
					font-family: PingFangSC-Regular, PingFang SC;
					font-weight: 400;
					color: #000000;
					line-height: 37rpx;
				}

				.input-prop {
					margin-top: 12rpx;
					height: 88rpx;
					width: 470rpx;
					border-bottom: 1rpx solid #F2F2F2;
				}

				.placeholder {
					font-size: 24rpx;
					font-family: PingFangSC-Regular, PingFang SC;
					font-weight: 400;
					color: #808080;
					line-height: 33rpx;
				}

				.sures {
					margin-top: 60rpx;
					text-align: center;
					line-height: 86rpx;
					width: 470rpx;
					height: 86rpx;
					background: #FE3B33;
					border-radius: 4rpx;
					font-size: 28rpx;
					font-family: PingFangSC-Medium, PingFang SC;
					font-weight: 500;
					color: #FFFFFF;
				}

				.codes {
					position: absolute;
					right: 43rpx;
					bottom: 210rpx;
					font-size: 24rpx;
					font-family: PingFangSC-Regular, PingFang SC;
					font-weight: 400;
					color: #FE3B33;
					line-height: 33rpx;
				}
			}
		}
	}
</style>